package app

import (
	"fmt"
	"net/http"
)

//提示:业务代码不要主动写panic

type exception struct {
}

var Exception exception

func (this *exception) Handle(res http.ResponseWriter) {
	if err := recover(); err != nil {
		fmt.Println("捕获到了 panic 产生的异常: ", err)
		msg := fmt.Sprintf("异常: %s", err)
		res.Write([]byte(msg))
	}
}
